package br.inf.solutions.apresentacoes.ssp.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import br.com.vexillum.model.CommonEntityActivated;
import br.com.vexillum.model.annotations.Validate;
import br.com.vexillum.model.annotations.ValidatorClass;

@SuppressWarnings("serial")
@ValidatorClass(validatorClass="br.inf.solutions.gestao.base.control.validators.AddressValidator")
@Entity
@Table(name="address")
public class Address extends CommonEntityActivated {
		
	@Validate(notNull=true)
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="id_neighborhood", nullable=false, updatable=true)
	private Neighborhood neighborhood;
		
	@Validate(notNull=true, max=1000)
	@Column(name="street", nullable=false, unique=false, updatable=true, length=500)
	private String	street;
	
	@Validate(max=50)
	@Column(name="lot", nullable=true, unique=false, updatable=true, length=100)
	private String	lot;
		
	@Validate(max=50)
	@Column(name="block", nullable=true, unique=false, updatable=true, length=100)
	private String 	block;
	
	@Validate(max=200)
	@Column(name="complement", nullable=true, unique=false, updatable=true, length=100)
	private String	complement;
		
	@Validate(notNull=true, max=10)
	@Column(name="number", nullable=false, unique=false, updatable=true)
	private String	number;
	
	@Validate(notNull=true, max=10)
	@Column(name="cep", nullable=false, unique=false, updatable=true, length=20)
	private String	cep;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy="address",targetEntity=Provider.class)	
	private List<Provider> providers;

	public List<Provider> getProviders() {
		return providers;
	}

	public void setProviders(List<Provider> providers) {
		this.providers = providers;
	}

	public Neighborhood getNeighborhood() {
		return neighborhood;
	}

	public void setNeighborhood(Neighborhood neighborhood) {
		this.neighborhood = neighborhood;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getLot() {
		return lot;
	}

	public void setLot(String lot) {
		this.lot = lot;
	}

	public String getBlock() {
		return block;
	}

	public void setBlock(String block) {
		this.block = block;
	}

	public String getComplement() {
		return complement;
	}

	public void setComplement(String complement) {
		this.complement = complement;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getCep() {
		return cep;
	}

	public void setCep(String cep) {
		this.cep = cep;
	}	
}
